import { Tabs } from 'antd-mobile'
import { Component } from 'react'
import router from 'umi/router';
class Manager extends Component {
  constructor(props) {
    super(props)
    this.tabChange = this.tabChange.bind(this)
  }
  state = {
    tabs: [
      {
        title: '员工管理',
        key: '/worker'
      },
      {
        title: '个人中心',
        key: '/center'
      }
    ]
  }
  tabChange(tab) {
    const { match } = this.props
    router.push({
      pathname: match.url + tab.key
    })
  }
  render() {
    return <div style={{height: '100vh'}}>
      <Tabs
        prerenderingSiblingsNumber={0}
        onChange={this.tabChange}
        page={this.props.location.pathname.split(this.props.match.url)[1]} tabBarPosition="bottom" tabs={this.state.tabs}
      >
        {this.props.children}
      </Tabs>
    </div>
  }
}
export default Manager